package com.cscj.android.repository.repo.shortcut

import com.cscj.android.repository.db.entity.ShortCutEntryEntity
import com.cscj.android.repository.network.Result
import com.cscj.android.repository.uidata.ShortCutUIData
import kotlinx.coroutines.flow.Flow

interface ShortCutRepository {


    suspend fun addLinkShortCut(shortCutId: Int): Result<Unit>

    suspend fun addHistoryShortCut(
        name: String? = null,
        link: String? = null,
        icon: String? = null,
        isRoot: Boolean
    ): Result<Unit>

    suspend fun addFavoriteShortCut(
        name: String? = null,
        link: String? = null,
        icon: String? = null,
        isRoot: Boolean
    ): Result<Unit>

    suspend fun deleteShortCutEntry(shortCutId: Int): Result<Unit>

    /**
     * 添加至首页数据
     */
    fun loadShortCuts(): Flow<Result<List<ShortCutUIData>>>

    fun localShortCutEntriesFlow(): Flow<List<ShortCutEntryEntity>>

    suspend fun loadShortCutEntries(): Result<Unit>


    suspend fun isItemAdded(type: Int, url: String? = null): Boolean


}